function $(a) {
  return document.querySelector(a);
}

function previewFile(a, b) {
  var onImg = document.querySelector(a);
  var file = document.querySelector(b).files[0];
  var reader = new FileReader();
  reader.addEventListener(
    "load",
    function () {
      onImg.src = this.result;
    },
    false
  );

  if (file) {
    reader.readAsDataURL(file);
  }
}

window.onload = function () {
  // 电影分类
  (function () {
    axios({
      method: "get",
      url: "/type/s",
    })
      .then(function (data) {
        var list = data.data.data.data;
        console.log(list[0]);
        for (let i = 0; i < 26; i++) {
          $(
            ".type"
          ).innerHTML += `<option value ="${list[i]}">${list[i]}</option>`;
          $(
            ".type1"
          ).innerHTML += `<option value ="${list[i]}">${list[i]}</option>`;
        }
      })
      .catch((err) => {
        console.log(err);
      });
  })();
  // 地区分类
  (function () {
    axios({
      method: "get",
      url: "/type/areaTags",
    })
      .then(function (data) {
        var list = data.data.data.data;
        for (let i = 0; i < list.length; i++) {
          $(
            ".area"
          ).innerHTML += `<option value ="${list[i]}">${list[i]}</option>`;
          $(
            ".area1"
          ).innerHTML += `<option value ="${list[i]}">${list[i]}</option>`;
        }
      })
      .catch((err) => {
        console.log(err);
      });
  })();
  // 年份标签
  (function () {
    axios({
      method: "get",
      url: "/type/yearTags",
    })
      .then(function (data) {
        var list = data.data.data.data;
        console.log(list);
        for (let i = 0; i < list.length; i++) {
          $(".year").innerHTML += `<option value ="${list[i].replace(
            "_",
            ""
          )}">${list[i].replace("_", "")}</option>`;
          $(".year1").innerHTML += `<option value ="${list[i].replace(
            "_",
            ""
          )}">${list[i].replace("_", "")}</option>`;
        }
      })
      .catch((err) => {
        console.log(err);
      });
  })();

  // 重置预览图片
  document.querySelector(".clear").onclick = function () {
    var pre = document.querySelector(".box");
    pre.src = "";
    $(".photo").value = "";
  };
  document.querySelector(".clear1").onclick = function () {
    var pre1 = document.querySelector(".box1");
    pre1.src = "";
    $(".gif").value = "";
  };
  // document.querySelector(".clear2").onclick = function () {
  //   var pre2 = document.querySelector(".box3");
  //   console.log(1);
  //   pre2.src = "";
  //   $(".photo1").value = "";
  // };
  var tbody = document.querySelector("tbody");
  // 预览大图片
  function displayphoto1(a, list) {
    var videophoto = document.querySelectorAll(a);
    for (let j = 0; j < videophoto.length; j++) {
      videophoto[j].onclick = function () {
        console.log(j);
        $(".bigphoto").src = list[j].videoPhoto;
        $(".photo-box").style.display = "block";
        // 退出照片预览
        $(".back4").onclick = function () {
          $(".photo-box").style.display = "none";
        };
      };
    }
  }
  function displaygif(a, list) {
    var gifpath = document.querySelectorAll(a);
    for (let j = 0; j < gifpath.length; j++) {
      gifpath[j].onclick = function () {
        console.log(j);
        $(".biggif").src = list[j].gifpath;
        $(".gif-box").style.display = "block";
        // 退出照片预览
        $(".back5").onclick = function () {
          $(".gif-box").style.display = "none";
        };
      };
    }
  }

  //  全部数据
  $(".alllist").onclick = function () {
    $(".pageSize").style.display = "block";
    $(".pageSize1").style.display = "none";
    $(".nowpage-1").innerHTML = 1;
    $(".nowpage").value = $(".nowpage-1").innerHTML;
    $("#search").value = "";
    fenye(1, $(".pageSize").value);
  };

  // 点击显示数据每页几条
  $(".pageSize").onchange = function () {
    $(".nowpage-1").innerHTML = 1;
    $(".nowpage").value = $(".nowpage-1").innerHTML;
    fenye(1, $(".pageSize").value);
  };
  $(".pageSize1").onchange = function () {
    $(".nowpage-1").innerHTML = 1;
    $(".nowpage").value = $(".nowpage-1").innerHTML;
    searchdata(1, $(".pageSize1").value);
  };
  // 弹窗显示
  function popup(a, b, c) {
    a.addEventListener("click", function () {
      b.style.display = "block";
    });
    c.addEventListener("click", function () {
      b.style.display = "none";
    });
  }
  popup($(".add-all"), $(".add-box"), $(".back"));
  // 简介字数太多隐藏
  function str(b) {
    let s = "";
    let length = 15;
    if (b.length >= length) {
      for (let i = 0; i < length; i++) {
        s += b[i];
      }
      s += "...";
    } else {
      for (let i = 0; i < b.length; i++) {
        s += b[i];
      }
    }
    return s;
  }
  // 分页数据
  function list(data, b) {
    let list = data.data.data.data.list;
    let pageNow = data.data.data.data.pageNow;
    for (let i = 0; i < list.length; i++) {
      let tds = ` <tr>
            <td>${i + 1 + (pageNow - 1) * $(".pageSize").value + "、"}</td>
            <td>${list[i].videoName == null ? "无" : list[i].videoName}</td>
            <td>${list[i].nickName == null ? "无" : list[i].nickName}</td>
            <td><a href='${
              list[i].videoPath == null ? "#" : list[i].videoPath
            }' style="text-decoration: none; font-weight:600;">${
        list[i].videoPath == null ? "无" : "链接"
      }</a></td>
            <td><img src="${
              list[i].gifpath == null ? "#" : list[i].gifpath
            }"  style="width:50px;height:50px" class="photo10"></td>
            <td><img src="${
              list[i].videoPhoto == null ? "#" : list[i].videoPhoto
            }"  style="width:50px; height:50px" class="photo11"></td>
            <td>${list[i].verifyNumber == 0 ? "审核" : "已审核"}</td>
            <td><button class="message">详情</button><button class="actor-btn"><i class="fa fa-star" aria-hidden="true"></i> 演员</button><button class='reason-btn'>状态</button><button class='audit-btn'>${
              list[i].verifyNumber == 0 ? "审核" : "已审核"
            }</button><button class='modify-btn'><i class="fa fa-pencil-square-o" aria-hidden="true"></i> 修改</button><button class='delete-user'><i class="fa fa-trash-o" aria-hidden="true"></i> 删除</button></td>
        </tr>`;
      $("tbody").insertAdjacentHTML("beforeend", tds);
    }
    var tbr = tbody.querySelectorAll("tr");
    console.log(tbr);
    for (let i = 0; i < tbr.length; i++) {
      if (i % 2 == 0) {
        tbr[i].style.backgroundColor = "rgb(220, 220, 220)";
        tbr[i].onmouseover = function () {
          this.style.backgroundColor = "rgb(202,170,145)";
        };
        tbr[i].onmouseout = function () {
          this.style.backgroundColor = "rgb(220, 220, 220)";
        };
      }
    }
    // 视频下的演员
    // 子评论按钮
    var actor_btn = document.querySelectorAll(".actor-btn");
    for (let i = 0; i < actor_btn.length; i++) {
      popup(actor_btn[i], $(".actor-box"), $(".back6"));
      actor_btn[i].onclick = function () {
        var videoId = list[i].videoId;
        console.log(videoId);
        actorAll(videoId);
      };
    }
    // 详情按钮
    var message_btn = document.querySelectorAll(".message");
    console.log(message_btn);
    for (let i = 0; i < message_btn.length; i++) {
      popup(message_btn[i], $(".user-box"), $(".back0"));
      message_btn[i].onclick = function () {
        var videoId = list[i].videoId;
        console.log(videoId);
        $(".video-videoName").innerHTML = list[i].videoName;
        $(".video-nickname").innerHTML = list[i].nickName;
        $(".video-type").innerHTML = list[i].videoType;
        $(".video-times").innerHTML = list[i].releaseTime;
        if (list[i].introduction.length > 15) {
          $(".video-introduction").innerHTML = `${str(
            list[i].introduction
          )} <button class="spread">展开</button>`;
          $(".spread").onclick = function () {
            $(".user-box").style.display = "none";
            $(".introduction-box").style.display = "block";
            $(".form-introduction").innerHTML = list[i].introduction;
            $(".back-introduction").onclick = function () {
              $(".user-box").style.display = "block";
              $(".introduction-box").style.display = "none";
            };
          };
        } else {
          $(".video-introduction").innerHTML = `${str(list[i].introduction)} `;
        }
        // $('.video-introduction').innerHTML = `${str(list[i].introduction)} <button>展开</button>`
        $(".video-doh").innerHTML = list[i].doh;
        if (list[i].verifyNumber == 1) {
          $(".video-verifyNumber").innerHTML = "通过";
        } else if (list[i].verifyNumber == 0) {
          $(".video-verifyNumber").innerHTML = "未审核";
        } else {
          $(".video-verifyNumber").innerHTML = "不通过";
        }
        $(".video-whetherFree").innerHTML = list[i].whetherFree;
        $(".video-area").innerHTML = list[i].regionType;
        $(".video-Tags").innerHTML = list[i].videoTags;
        $(".video-year").innerHTML = list[i].videoYear.replace("_", "");
      };
    }
    // 照片预览
    displaygif(".photo10", list);
    displayphoto1(".photo11", list);
    // 删除按钮绑定
    var del_btn = document.querySelectorAll(".delete-user");
    for (let i = 0; i < del_btn.length; i++) {
      del_btn[i].onclick = function () {
        var x = 2;
        if ((x = 2)) {
          console.log(x);
          $(".form-pop").querySelector("p").innerHTML = "你确定要删除吗？";
          $(".pop-box").style.display = "block";
          $(".submit-pop1").onclick = function () {
            var videoId = list[i].videoId;
            console.log(videoId);
            delete_video(videoId, b);
            $(".pop-box").style.display = "none";
          };
          $(".submit-pop2").onclick = function () {
            $(".pop-box").style.display = "none";
          };
          $(".back-pop").onclick = function () {
            $(".pop-box").style.display = "none";
          };
        }
      };
    }
    //     var del_btn = document.querySelectorAll('.delete-user');
    //  for(let i = 0 ;i<del_btn.length; i++){
    //  del_btn[i].addEventListener('click',function(){
    // var videoId =list[i].videoId;
    // console.log(videoId)
    // delete_video(videoId,b);
    //  })
    //  }
    //  分页的总量
    var pageTotal = data.data.data.data.pageTotal;
    var pageTotalCount = data.data.data.data.pageTotalCount;

    // 跳转按钮
    $(".nowpage").value = $(".nowpage-1").innerHTML;
    $(".nowpage-btn-2").onclick = function () {
      $(".nowpage-1").innerHTML =
        $(".nowpage").value > pageTotal ? pageTotal : $(".nowpage").value;
      searchdata($(".nowpage-1").innerHTML, $(".pageSize").value);
    };
    $(".nowpage-btn-1").onclick = function () {
      $(".nowpage-1").innerHTML =
        $(".nowpage").value > pageTotal ? pageTotal : $(".nowpage").value;
      fenye($(".nowpage-1").innerHTML, $(".pageSize").value);
    };
    $(".total").innerHTML = `共${pageTotal}页共${pageTotalCount}条数据`;
    if (pageTotal < 3) {
      for (let i = 0; i < pageTotal; i++) {
        let a = ` <a href="JavaScript:;" class='pagebtn'>${i + 1}</a>`;
        $(".pageye").insertAdjacentHTML("beforeend", a);
      }
    } else {
      for (let i = 0; i < 3; i++) {
        let a = ` <a href="JavaScript:;" class='pagebtn'>${i + 1}</a>`;
        $(".pageye").insertAdjacentHTML("beforeend", a);
      }
      var pagebtnAll = document.querySelectorAll(".pagebtn");
      if ($(".nowpage").value >= 3) {
        let c = $(".nowpage").value;
        let a = c >= pageTotal - 1 ? (c = pageTotal - 1) : c;
        pagebtnAll[0].innerHTML = a - 1;
        pagebtnAll[1].innerHTML = a;
        pagebtnAll[2].innerHTML = ++a;
      }
    }
    var pagebtnAll = document.querySelectorAll(".pagebtn");
    for (let i = 0; i < pagebtnAll.length; i++) {
      pagebtnAll[i].onclick = function () {
        b(this.innerHTML, $(".pageSize").value);
        $(".nowpage-1").innerHTML = `${this.innerHTML}`;
        $(".nowpage").value = $(".nowpage-1").innerHTML;
      };
      if (pagebtnAll[i].innerHTML == $(".nowpage-1").innerHTML) {
        pagebtnAll[i].style.backgroundColor = "rgb(202,170,145)";
      } else if (pagebtnAll[i].innerHTML == $(".nowpage").value) {
        for (let j = 0; j < pagebtnAll.length; j++) {
          pagebtnAll[j].style.backgroundColor = "";
        }
        pagebtnAll[i].style.backgroundColor = "rgb(202,170,145)";
      }
    }
    $("#next").onclick = function () {
      var x = $(".nowpage-1").innerHTML;
      x++;
      var y = x >= pageTotal ? (x = pageTotal) : x;
      $(".nowpage-1").innerHTML = `${y}`;
      $(".nowpage").value = $(".nowpage-1").innerHTML;
      b($(".nowpage-1").innerHTML, $(".pageSize").value);
      console.log($(".nowpage-1").innerHTML, $(".nowpage").value);
      console.log($(".nowpage").value);
    };
    $("#pre").onclick = function () {
      var x = $(".nowpage-1").innerHTML;
      x--;
      var y = x <= 1 ? (x = 1) : x;
      $(".nowpage-1").innerHTML = `${y}`;
      $(".nowpage").value = $(".nowpage-1").innerHTML;
      b($(".nowpage-1").innerHTML, $(".pageSize").value);
    };
    $(".frist").onclick = function () {
      $(".nowpage-1").innerHTML = `1`;
      $(".nowpage").value = $(".nowpage-1").innerHTML;
      b(1, $(".pageSize").value);
    };
    $(".last").onclick = function () {
      $(".nowpage-1").innerHTML = `${pageTotal}`;
      $(".nowpage").value = $(".nowpage-1").innerHTML;
      b(pageTotal, $(".pageSize").value);
    };

    //  修改按钮绑定
    var modify_btn = document.querySelectorAll(".modify-btn");
    for (let i = 0; i < modify_btn.length; i++) {
      popup(modify_btn[i], $(".modify-box"), $(".back1"));
      modify_btn[i].onclick = function () {
        $(".videoName1").value = list[i].videoName;
        $(".area1").value = list[i].regionType;
        $(".type1").value = list[i].videoType;
        $(".whetherFree1").value = list[i].whetherFree;
        $(".year1").value = list[i].videoYear.replace("_", "");
        $(".videoTags1").value = list[i].videoTags;
        $(".introduction1").value = list[i].introduction;
        let videoId = list[i].videoId;
        console.log(videoId);
        modify_video(videoId);
      };
    }
    // 审核视频
    var audit_btn = document.querySelectorAll(".audit-btn");
    for (let i = 0; i < audit_btn.length; i++) {
      if (audit_btn[i].innerHTML == "已审核") {
        audit_btn[i].disabled = true;
        audit_btn[i].style.color = "rgb(83, 83, 83)";
        audit_btn[i].style.cursor = "not-allowed";
      }
      popup(audit_btn[i], $(".audit-box"), $(".back2"));
      audit_btn[i].onclick = function () {
        $(".text").value = "";
        var videoId = list[i].videoId;
        console.log(videoId);
        audit(videoId, b);
      };
    }

    // 理由按钮绑定
    var reason_btn = document.querySelectorAll(".reason-btn");
    for (let i = 0; i < reason_btn.length; i++) {
      reason_btn[i].addEventListener("click", function () {
        $(".p0").innerHTML = `视频名称: ${list[i].videoName}`;
        $(".reason-box").style.display = "block";
        $(".back3").onclick = function () {
          $(".reason-box").style.display = "none";
        };
        var videoId = list[i].videoId;
        console.log(videoId);
        auditdata(videoId);
      });
    }
  }

  // 分页渲染数据
  function fenye(a, b) {
    axios({
      method: "get",
      url: "/videoCRUD/findAllVideo",
      params: {
        pageNow: a,
        pageSize: b,
      },
    })
      .then(function (data) {
        $("tbody").innerHTML = "";
        $(".pageye").innerHTML = "";
        list(data, fenye);
      })
      .catch((err) => {
        console.log(err);
      });
  }
  fenye(1, 10);
  // 删除单个数据
  function delete_video(videoId, b) {
    axios({
      method: "delete",
      url: "/videoCRUD/deleteVideo",
      params: {
        videoId: videoId,
      },
    })
      .then(function (data) {
        $(
          ".not"
        ).innerHTML = `<i class="fa fa-check" aria-hidden="true" style="color:green"></i>删除成功`;
        $(".not").style.display = "";
        setTimeout(() => {
          $(".not").style.display = "none";
        }, 1500);
        if ($("tbody").innerHTML == "") {
          fenye($(".nowpage-1").innerHTML, $(".pageSize").value);
        } else {
          b($(".nowpage-1").innerHTML, $(".pageSize").value);
        }
      })
      .catch((err) => {
        console.log(err);
      });
  }
  // 添加视频
  $(".submit").onclick = function () {
    var file = $(".file").files[0];
    var gif = $(".gif").files[0];
    var photo = $(".photo").files[0];
    const formdata = new FormData();
    formdata.append("File", file);
    formdata.append("Gif", gif);
    formdata.append("photo", photo);
    axios({
      url: "/video/videoCRUD/addVideo",
      data: formdata,
      params: {
        videoName: $(".videoName").value,
        videoBriefly: $(".videoBriefly").value,
        videoTags: $(".videoTags").value,
        type: $(".type").value,
        introduction: $(".introduction").value,
        whetherFree: $(".whetherFree").value,
        year: $(".year").value,
        area: $(".area").value,
        userid: 1,
      },
      method: "post",
      onUploadProgress: function (e) {
        console.log(e);
        // if (e.lengthComputable) {
        //   // that.progress = (e.loaded / e.total) * 100;
        // }
      },
    })
      .then((data) => {
        console.log(data.data);
        if (data.data.data.message == "成功") {
          $(
            ".not"
          ).innerHTML = `<i class="fa fa-check" aria-hidden="true" style="color:green"></i> 添加成功`;
          $(".not").style.display = "";
          setTimeout(() => {
            $(".not").style.display = "none";
          }, 1500);
          $(".add-box").style.display = "none";
          fenye($(".nowpage-1").innerHTML, $(".pageSize").value);
        } else {
          $(
            ".not"
          ).innerHTML = `<i class="fa fa-times" aria-hidden="true" style="color:red;"></i> 添加失败`;
          $(".not").style.display = "";
          setTimeout(() => {
            $(".not").style.display = "none";
          }, 1500);
          $(".add-box").style.display = "none";
        }
      })
      .catch((err) => {
        console.log("addAdvertisement err : ", err);
      });
  };

  // 模糊查询
  function searchdata(a, b) {
    var search_input = document.querySelector("#search");
    axios({
      method: "get",
      url: "/videoCRUD/findLikeVideoName",
      params: {
        videoName: search_input.value,
        pageNow: a,
        pageSize: b,
      },
    })
      .then(function (data) {
        if (data.data.data.data.list.length == 0) {
          $("#search").value = "";
          $(".pageSize1").style.display = "none";
          $(".pageSize").style.display = "";
          $(".nowpage-btn-2").style.display = "none";
          $(".nowpage-btn-1").style.display = "";
          $(
            ".not"
          ).innerHTML = `<i class="fa fa-exclamation-circle" style="color: rgb(255, 187, 0);" aria-hidden="true"></i>抱歉找不到`;
          $(".not").style.display = "";
          setTimeout(() => {
            $(".not").style.display = "none";
          }, 1500);
        } else {
          $("tbody").innerHTML = "";
          $(".pageye").innerHTML = "";
          $(".pageSize1").style.display = "";
          $(".pageSize").style.display = "none";
          $(".nowpage-btn-2").style.display = "";
          $(".nowpage-btn-1").style.display = "none";
          list(data, searchdata);
        }
      })
      .catch((err) => {
        console.log(err);
      });
  }
  //  点击搜索按钮
  $(".search-btn").addEventListener("click", function () {
    $(".nowpage-1").innerHTML = 1;
    $(".nowpage").value = $(".nowpage-1").innerHTML;
    var search_input = document.querySelector("#search");
    if (search_input.value == "") {
      $(
        ".not"
      ).innerHTML = `<i class="fa fa-exclamation-circle" style="color: rgb(255, 187, 0);" aria-hidden="true"></i>抱歉找不到`;
      $(".not").style.display = "";
      setTimeout(() => {
        $(".not").style.display = "none";
      }, 1500);
    } else {
      $(
        ".not"
      ).innerHTML = `<i class="fa fa-check" aria-hidden="true" style="color:green"></i>搜索成功`;
      $(".not").style.display = "";
      setTimeout(() => {
        $(".not").style.display = "none";
      }, 1500);
      searchdata(1, $(".pageSize").value);
    }
  });

  //   修改视频
  function modify_video(videoId) {
    $(".submit1").onclick = function () {
      axios({
        url: "/video/videoCRUD/updateVideo",
        params: {
          videoName: $(".videoName1").value,
          videoTags: $(".videoTags1").value,
          type: $(".type1").value,
          introduction: $(".introduction1").value,
          whetherFree: $(".whetherFree1").value,
          year: $(".year1").value,
          area: $(".area1").value,
          videoId: videoId,
        },
        method: "put",
      })
        .then((data) => {
          console.log(data.data);
          //   if (data.data.data.message == "成功") {
          //     $(
          //       ".not"
          //     ).innerHTML = `<i class="fa fa-check" aria-hidden="true" style="color:green"></i> 修改成功`;
          //     $(".not").style.display = "";
          //     setTimeout(() => {
          //       $(".not").style.display = "none";
          //     }, 1500);
          //     $(".add-box").style.display = "none";
          //     fenye($(".nowpage-1").innerHTML, $(".pageSize").value);
          //   } else {
          //     $(
          //       ".not"
          //     ).innerHTML = `<i class="fa fa-times" aria-hidden="true" style="color:red;"></i> 修改失败`;
          //     $(".not").style.display = "";
          //     setTimeout(() => {
          //       $(".not").style.display = "none";
          //     }, 1500);
          //     $(".add-box").style.display = "none";
          //   }
        })
        .catch((err) => {
          console.log("addAdvertisement err : ", err);
        });
    };
  }

  // 审核视频
  function audit(videoId, b) {
    console.warn($(".auditselect").value);
    $(".submit2").onclick = function () {
      axios({
        method: "post",
        url: "/verify/auditVideo",
        params: {
          videoId: videoId,
          verifyNumber: $(".auditselect").value,
          passReason: $(".text").value,
        },
      })
        .then(function (data) {
          let da = data.data.data;
          console.log(da);
          if (da.message == "参数不正确") {
            alert("请输入理由");
          } else if (da.data == "该视频已被审核过，请勿重复操作") {
            alert(da.data);
            $(".audit-box").style.display = "none";
          } else {
            alert("审核通过");
            $(".audit-box").style.display = "none";
            b($(".nowpage-1").innerHTML, $(".pageSize").value);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    };
  }
  // 审核理由
  function auditdata(videoId) {
    axios({
      method: "get",
      url: "/verify/findVerifyReasonByVideoId",
      params: {
        videoId: videoId,
      },
    })
      .then(function (data) {
        var da = data.data.data;
        console.log(da.data);
        console.log($(".p1"));
        if (da.data == null) {
          $(".p1").innerHTML = `审核状态:  未审核`;
          $(".p2").innerHTML = `审核理由:  无`;
        } else {
          $(".p1").innerHTML = `审核状态:  ${
            da.data.verifyNumber == 1 ? "通过" : "不通过"
          }`;
          $(".p2").innerHTML = `审核理由:  ${da.data.failedReason}`;
        }
      })
      .catch((err) => {
        console.log(err);
      });
  }

  // 查询视频下的演员
  function actorAll(videoId) {
    // 遍历子评论
    axios({
      method: "get",
      url: "/actor/findAllActorsByVideoId",
      params: {
        videoId: videoId,
      },
    })
      .then(function (data) {
        $(".listbody").innerHTML = "";
        console.log(data.data.data);
        listactorAll(data);
      })
      .catch((err) => {
        console.log(err);
      });
  }
  // 遍历视频下的演员
  function listactorAll(data) {
    let list = data.data.data;
    for (let i = 0; i < list.length; i++) {
      let tds = ` <tr>
        <td>${i + 1}</td>
        <td>${list[i].actorName == null ? "无" : list[i].actorName}</td>
        <td><img src="${
          list[i].actorSrc == null ? "#" : list[i].actorSrc
        }"  style="width:50px;height:50px" class="photo12"></td>
        <td><button class='delete-actor'><i class="fa fa-trash-o" aria-hidden="true"></i> 删除</button></td>
    </tr>`;
      $(".listbody").insertAdjacentHTML("beforeend", tds);
      let tbr = $(".listbody").querySelectorAll("tr");
      if (i % 2 == 0) {
        tbr[i].style.backgroundColor = "rgb(220, 220, 220)";
        tbr[i].onmouseover = function () {
          this.style.backgroundColor = "rgb(202, 170, 145)";
        };
        tbr[i].onmouseout = function () {
          this.style.backgroundColor = "rgb(220, 220, 220)";
        };
      }
    }
    displayphoto1(".photo12", list);
    // // 删除按钮
    // let delete_commentSonbtn = document.querySelectorAll('.delete-commentSon')
    // for(let i = 0 ; i<delete_commentSonbtn.length;i++){
    //     delete_commentSonbtn[i].onclick=function(){
    //         let commentSonId=list[i].commentSonId
    //         console.log(commentSonId);
    //         delete_commentSon(commentSonId);
    //     }
    // }
    // // 复选框
    // var checkbox1 = document.querySelectorAll('.chexkbox1');
    //     $('#checkbox-all1').onclick=function(){
    //        if($('#checkbox-all1').checked){
    //         for(let i = 0 ;i< checkbox1.length; i++){
    //             checkbox1[i].checked = 'checked';
    //        }
    //        }else{
    //         for(let i = 0 ;i< checkbox1.length; i++){
    //             checkbox1[i].checked = '';
    //        }
    //        }
    // }
    // $('.delete-commentSonAll').onclick=function(){
    //     if(confirm('你是否要批量删除')){
    //     for(let i = 0 ;i< checkbox1.length; i++){
    //         if(checkbox1[i].checked){
    //             let commentSonId=list[i].commentSonId;
    //             console.log(commentSonId);
    //             delete_AllcommentSon(commentSonId);
    //         }
    // }
    // $('.not1').innerHTML=`<i class="fa fa-times-circle-o" aria-hidden="true"  style="color:red;"></i>删除成功`
    //         $('.not1').style.display=''
    //         setTimeout(() => {
    //            $('.not1').style.display='none'
    //        }, 2000);
    // commentSon(list[0].commentId)
    // }
    // }
  }
};
